<template>
  <div class="like-page">
    <van-nav-bar title="我的点赞" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <article-item
        :item="item"
        v-for="item in list"
        :key="item.id"
      ></article-item>
    </van-list>
  </div>
</template>

<script>
import { LikeList } from '@/api/article'
export default {
  name: 'LikePage',
  data () {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 1
    }
  },
  methods: {
    async onLoad () {
      const res = await LikeList({
        optType: 1,
        page: this.page,
        pageSize: 5
      })
      this.list.push(...res.data.rows)
      this.loading = false
      this.page++
      if (this.page > res.data.pageTotal) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
   .van-list{
    margin-bottom: 50px;
  }
</style>
